<template>
    <div class="wrapper">
       <swiper :options="SwiperOptions" v-if="showSwiper">
           <swiper-slide v-for="(item,index) in list" :key="index">
               <img class="slide-img" :src="item.imgUrl" />
           </swiper-slide>
           <div class="swiper-pagination" slot="pagination"></div>
       </swiper>
    </div>
</template>

<script>
    export default {
        name: 'HomeSwiper',
        props:{
            list:Array
        },
        data () {
            return {
                SwiperOptions: {
                    loop: true,
                    pagination: '.swiper-pagination',
                    autoplay: 3000,
                    speed: 1000
                }
            }
        },
        computed: {
            showSwiper() {
                return this.list.length;
            }
        }
    }
</script>

<style lang="stylus" scoped>
    .wrapper >>> .swiper-pagination-bullet-active
       background:red;
    .wrapper
       width:100%;
       height:0;
       padding-bottom:31.3%;
       overflow:hidden;
       .slide-img
            width:100%;
</style>